﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewRequest.aspx.cs" Inherits="ServerPayRequest.NewRequest" %>

<%@ Register Src="../../Processes/ProcessControl/UserInfo_TY.ascx" TagName="UserInfo"
    TagPrefix="ui" %>
<%@ Register Src="../../Processes/ProcessControl/ApprovalHistory_TY.ascx" TagName="ApprovalHistory"
    TagPrefix="ah" %>
<%@ Register Src="../../Processes/ProcessControl/Attachments_TY.ascx" TagName="Attachments"
    TagPrefix="attach" %>
<%@ Register Src="../../Processes/ProcessControl/ButtonList_TY.ascx" TagName="ButtonList"
    TagPrefix="btn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>服务外包资金支付及发票报销申请</title>
    <script src="../../js/jquery.js" type="text/javascript"></script>
    <script src="../../js/common.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" language="javascript">

        //删除当前行
        function deletetS(rows) {

            $(rows).parent().parent().find("[id*=fld_CONTRACTNUM]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_SUPPLIERNAME]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_CONTENT]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_CONTRACTAMOUNT]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_SUPPLIERNUM]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_CONTRACTCOUNT]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_HASPAYAMOUNT]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_THEAMOUNT]").attr("class", ".");
            $(rows).parent().parent().find("[id*=fld_PAYMENTTIME]").attr("class", ".");

        }

        function check(ID) {
            //var hidvalue = $("#hidValue")
            if (ID == 'rdoMoney') {

                document.getElementById("DivMoney").style.display = "";
                document.getElementById("DivContract").style.display = "none";
                $("#fld_FORMTYPE").val('资金支付类');

            } else if (ID == 'rdoRemiber') {
                document.getElementById("DivMoney").style.display = "none";
                document.getElementById("DivContract").style.display = "";
                $("#fld_FORMTYPE").val('发票报销类');
            }
        }

        function changeRMB() {
            var JE = $("#fld_PAYAMOUNT").val();
            var STRRMB = ChangeRMB(JE);
            $("#lblPAYACMOUNTUPPER").text(STRRMB);
            $("#fld_PAYACMOUNTUPPER").val(STRRMB);
        }
        function getSum() {
            var Sum = 0;
            $("#tbDetail tr:gt(0)").each(function (i, Etr) {
                Sum += $(Etr).find("td:eq(7)").children().val() - 0;
            });
            $("#fld_PAYAMOUNT").val(Sum);
            $("#lblPAYAMOUNT").text(Sum);
            if (Sum != 0) {
                changeRMB();
            }
        }
        $(function () {
            $("#fld_CONTRACTAMOUNT").blur(function () {
                var upper = ChangeRMB($(this).val());
                $("#fld_CONTRACTAMOUNTUPPER").val(upper);
                $("#lblCONTRACTAMOUNTUPPER").text(upper);
            });
            getSum();

            if ($("#fld_FORMTYPE").val() != "") {
                if ($("#fld_FORMTYPE").val() == "资金支付类") {
                    document.getElementById("DivMoney").style.display = "";
                    document.getElementById("DivContract").style.display = "none";
                    $("#fld_FORMTYPE").val("资金支付类");
                    document.getElementById("rdoMoney").checked = "checked";
                }
                else {
                    $("#fld_FORMTYPE").val("发票报销类");
                    document.getElementById("DivMoney").style.display = "none";
                    document.getElementById("DivContract").style.display = "";
                    document.getElementById("rdoRemibur").checked = "cheked";
                }

            }
        });

        jQuery(document).ready(function () {

            if (request("Type") == "myrequest") {
                $("#rdoType").css("display", "none");
                $("#divType").css("display", "block");
            }
        });
    </script>
    <script type="text/javascript" language="javascript">
        window.onload = function () {
            document.getElementById("fld_YHKH").onkeyup = function () {
                this.value = this.value.replace(/\s/g, '').replace(/(\d{4})(?=\d)/g, "$1 "); ;
            };
        }; </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <div class="row">
            <ui:userinfo id="UserInfo1" processtitle="服务外包资金支付及发票报销申请" runat="server" tablename="PROC_SERVERPAYREQUEST"
                tablenamedetail="PROC_SERVERPAYREQUEST_DETAIL"></ui:userinfo>
        </div>
        <div class="row">
            <table class="table table-condensed table-bordered">
                <thead class="table table-condensed table-bordered">
                    <tr>
                        <td class="td-label">
                            表单类别<span class="red">*</span>
                        </td>
                        <td class="td-content" colspan="3">
                            <div id="rdoType">
                                <span onclick="check('rdoMoney')">
                                    <asp:RadioButton ID="rdoMoney" runat="server" Checked="true" GroupName="rdos" Text="资金支付类" /></span>
                                <span onclick="check('rdoRemiber')">
                                    <asp:RadioButton ID="rdoRemibur" runat="server" GroupName="rdos" Text="发票报销类" /></span>
                            </div>
                            <div id="divType" style="display: none">
                                <asp:TextBox ID="fld_FORMTYPE" runat="server" Text="资金支付类"></asp:TextBox>
                            </div>
                        </td>
                    </tr>
                </thead>
                <tbody id="DivMoney" class="table table-condensed table-bordered">
                    <tr>
                        <td class="banner" colspan="4">
                            资金报销
                        </td>
                    </tr>
                    <tr>
                        <td class="td-label">
                            是否在预算内：<span class="red">*</span>
                        </td>
                        <td class="td-content" colspan="3">
                            <asp:DropDownList ID="fld_ISINBUDGET" runat="server" CssClass="validate[required]">
                                <asp:ListItem Value="">--请选择--</asp:ListItem>
                                <asp:ListItem Value="是">是</asp:ListItem>
                                <asp:ListItem Value="否">否</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td class="td-label">
                            开户行：<span class="red">*</span>
                        </td>
                        <td class="td-content">
                            <asp:TextBox ID="fld_KHH" runat="server" class="validate[required]"></asp:TextBox>
                        </td>
                        <td class="td-label">
                            银行卡号：<span class="red">*</span>
                        </td>
                        <td class="td-content">
                            <asp:TextBox ID="fld_YHKH" runat="server" class="validate[required]"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="11">
                            <table class="table table-condensed table-bordered tablerequired" id="tbDetail">
                                <tr>
                                    <th>
                                        合同编号
                                    </th>
                                    <th>
                                        供应商名称
                                    </th>
                                    <th>
                                        内容
                                    </th>
                                    <th>
                                        合同金额
                                    </th>
                                    <th>
                                        供货数量
                                    </th>
                                    <th>
                                        合同数量
                                    </th>
                                    <th>
                                        已付金额
                                    </th>
                                    <th>
                                        本次所需金额
                                    </th>
                                    <th>
                                        预计付款时间
                                    </th>
                                    <th>
                                        <asp:Button ID="btnAdd" runat="server" Text="增加" CssClass="btn" CausesValidation="false"
                                            OnClick="btnAdd_Click" />
                                    </th>
                                </tr>
                                <asp:Repeater ID="fld_detail_PROC_SERVERPAYREQUEST_DETAIL" runat="server" OnItemCommand="fld_detail_PROC_SERVERPAYREQUEST_DETAIL_ItemCommand">
                                    <ItemTemplate>
                                        <tr>
                                            <td>
                                                <asp:TextBox ID="fld_FORMID" Text='<%#Eval("FORMID") %>' runat="server" Style="display: none"></asp:TextBox>
                                                <asp:TextBox ID="fld_CONTRACTNUM" Text='<%#Eval("CONTRACTNUM") %>' runat="server"
                                                    Width="80%" CssClass="validate[required]"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="fld_SUPPLIERNAME" Text='<%#Eval("SUPPLIERNAME") %>' runat="server"
                                                    Width="80%" CssClass="validate[required]"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="fld_CONTENT" Text='<%#Eval("CONTENT") %>' runat="server" Width="80%"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="fld_CONTRACTAMOUNT" Text='<%#Eval("CONTRACTAMOUNT") %>' money="money"
                                                    runat="server" Width="80%" CssClass="validate[required,custom[number]]"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="fld_SUPPLIERNUM" Text='<%#Eval("SUPPLIERNUM") %>' money="money"
                                                    runat="server" Width="80%" CssClass="validate[required]"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="fld_CONTRACTCOUNT" Text='<%#Eval("CONTRACTCOUNT") %>' money="money"
                                                    runat="server" Width="80%" CssClass="validate[required]"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="fld_HASPAYAMOUNT" Text='<%#Eval("HASPAYAMOUNT") %>' money="money"
                                                    runat="server" Width="80%" CssClass="validate[required,custom[number]]"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="fld_THEAMOUNT" Text='<%#Eval("THEAMOUNT") %>' money="money" runat="server"
                                                    Width="80%" CssClass="validate[required,custom[number]]" onblur="getSum()"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="fld_PAYMENTTIME" Text='<%#Eval("PAYMENTTIME") %>' runat="server"
                                                    Width="80%" OnClick="WdatePicker()" CssClass="Wdate validate[required,custom[date]]"></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:Button ID="btnDelete" runat="server" Text="删除" CssClass="btn" CommandName="del"
                                                    ClientIDMode="Static" OnClientClick="deletetS(this);return confirm('确认删除？')" />
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td class="td-label">
                            付款金额：
                        </td>
                        <td class="td-content">
                            <asp:Label ID="lblPAYAMOUNT" runat="server"></asp:Label>
                            <asp:TextBox ID="fld_PAYAMOUNT" runat="server" Style="display: none"></asp:TextBox>
                        </td>
                        <td class="td-label">
                            付款金额大写：
                        </td>
                        <td class="td-content">
                            <asp:Label ID="lblPAYACMOUNTUPPER" runat="server"></asp:Label>
                            <asp:TextBox ID="fld_PAYACMOUNTUPPER" runat="server" Style="display: none"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="td-label">
                            付款信息：
                        </td>
                        <td class="td-content" colspan="3">
                            <asp:TextBox ID="fld_PAYMENTINFO" runat="server" TextMode="MultiLine" Width="97%"
                                Height="40px"></asp:TextBox>
                        </td>
                    </tr>
                </tbody>
                <tbody id="DivContract" style="display: none;" class="table table-condensed table-bordered">
                    <tr>
                        <td class="banner" colspan="4">
                            合同发票
                        </td>
                    </tr>
                    <tr>
                        <td class="td-label">
                            发票所属公司：<span class="red">*</span>
                        </td>
                        <td class="td-content">
                            <asp:TextBox ID="fld_CONTRACTACOMPAY" runat="server" CssClass="validate[required]"></asp:TextBox>
                        </td>
                        <td class="td-label">
                            发票号：<span class="red">*</span>
                        </td>
                        <td class="td-content">
                            <asp:TextBox ID="fld_CONTRACTNUM" runat="server" CssClass="validate[required]"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="td-label">
                            发票金额：<span class="red">*</span>
                        </td>
                        <td class="td-content">
                            <asp:TextBox ID="fld_CONTRACTAMOUNT" money="money" runat="server" CssClass="validate[required]"></asp:TextBox>
                        </td>
                        <td class="td-label">
                            发票金额大写：
                        </td>
                        <td class="td-content">
                            <asp:Label ID="lblCONTRACTAMOUNTUPPER" runat="server"></asp:Label>
                            <asp:TextBox ID="fld_CONTRACTAMOUNTUPPER" runat="server" Style="display: none;"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="td-label">
                            发票信息：<span class="red">*</span>
                        </td>
                        <td class="td-content" colspan="3">
                            <asp:TextBox ID="fld_CONTRACTINFO" CssClass="validate[required]" runat="server" Width="97%"
                                Height="40px"></asp:TextBox>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="row">
            <attach:attachments id="Attachments1" runat="server"></attach:attachments>
        </div>
        <div class="row">
            <ah:approvalhistory id="ApprovalHistory1" showaction="false" runat="server"></ah:approvalhistory>
        </div>
        <div class="row">
        </div>
    </div>
    <btn:buttonlist id="ButtonList1" runat="server"></btn:buttonlist>
    <div style="display: none;">
    </div>
    </form>
</body>
</html>
